import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import { resolve } from 'path'
import { createHtmlPlugin } from "vite-plugin-html";
import { proTitle } from './baseUrl'

// https://vite.dev/config/
export default defineConfig({
  base: './',
  server: {
    host: '0.0.0.0',
    port: 9002,
    open: true
  },
  plugins: [
    react(),
    createHtmlPlugin({
      inject: {
        data: {
          //将环境变量 VITE_APP_TITLE 赋值给 title 方便 html页面使用 title 获取系统标题
          // title: getViteEnv(mode, "VITE_APP_TITLE"),
          title: proTitle
        },
      },
    }),
  ],
  resolve: {
    alias: [
      {
        find: '@',
        replacement: resolve(__dirname, 'src'),
      },
    ]
  },
})
